<?php include('header.php');?>
<?php 
$id = $_GET['id'];
?>
<script type="text/javascript">
//กรณีเลือกธนาคารให้เช็คฟังชั่นต่างๆ
function receive_select(rdo) {
    document.getElementById(rdo).checked = true;
}

//เมื่อเลือกธนาคารจะโฟกัสไปที่เป็นเงิน
function transfer_focus() {
    document.getElementById('transfer_total').focus();
}

//กรณีคิดส่วนลด เมื่อเอาเม้าออกจาก textbox
function clickrecall1(thisfield) {
    if (thisfield.value == "") {
        thisfield.value = document.getElementById('Sdiscount').value;
    }
}

//กรณีคิดส่วนลด เมื่อคลิ๊กที่ textbox
function clickclear1(thisfield, defaulttext) {
    if (thisfield.value == defaulttext) {
        thisfield.value = "";
        document.getElementById('Sdiscount').value = defaulttext;
    }
}

//กรณีคิดราคาเมื่อพิมพ์ส่วนลดเป็นเปอเซ็นต์ เอาไปแสดงใน textbox ยอดที่ลด
function sTotal1(){
	var total = parseFloat(document.getElementById('total').value);
	var discount = parseFloat(document.getElementById('cash_percent').value);
	//var discount2 = document.getElementById('cash_total').value;
	var result = 0;

	if(isNaN(total)){
		total = 0;
	}
	
	if(isNaN(discount)){
		discount = 0;
	}
	
	result = (discount/100)*total;
	document.getElementById('cash_total').value = result;
	sTotal2();
}

function ClearDis1(){
	document.getElementById('cash_percent').value = '0';
}

//เช็คฟอร์มก่อน submit
function DepositSubmit() {
    var rdo1 = document.getElementById('rRdo_1');
    var rdo2 = document.getElementById('rRdo_2');
    var rdo3 = document.getElementById('rRdo_3');
    if(rdo1.checked == false && rdo2.checked == false && rdo3.checked == false){
        alert('กรุณาเลือกประเภทการรับเงินมัดจำด้วยค่ะ');
        window.location = '#deposit_Form';
        return false;
    }
    if(rdo1.checked == true && (document.getElementById('cash_total').value == 0 || document.getElementById('cash_total').value == '')){
        alert('กรุณาระบุจำนวนเงินสดด้วยค่ะ')
        document.getElementById('cash_total').focus();
        return false;
    }
    
    if(rdo2.checked == true && document.getElementById('bank_transfer').value == ''){
        alert('กรุณาเลือกธนาคารด้วยค่ะ');
        document.getElementById('bank_transfer').focus();
        return false;
    }
    
     if(rdo2.checked == true && document.getElementById('transfer_total').value == ''){
        alert('กรุณาระบุจำนวนเงินโอนด้วยค่ะ');
        document.getElementById('transfer_total').focus();
        return false;
     }
     
     if(rdo3.checked == true && document.getElementById('check_number').value == ''){
        alert('กรุณาระบุเลชที่เช็คด้วยค่ะ');
        document.getElementById('check_number').focus();
        return false;
     }

     if(rdo3.checked == true && document.getElementById('check_bank').value == ''){
        alert('กรุณาระบุธนาคารเจ้าของเช็คด้วยค่ะ');
        document.getElementById('check_bank').focus();
        return false;
     }
     
     if(rdo3.checked == true && document.getElementById('check_total').value == ''){
        alert('กรุณาระบุจำนวนเงินเช็คด้วยค่ะ');
        document.getElementById('check_total').focus();
        return false;
     }    
     
     if(document.getElementById('name_receive').value == ''){
        alert('กรุณาระบุ ชื่อ-นามสกุล ผู้รับเงินมัดจำด้วยค่ะ');
        document.getElementById('name_receive').focus();
        return false;
     }
    
    document.form1.submit();
}
</script>
<body onload="onload();">
<form id="form1" name="form1" action="deposit_add.php" method="post">
<div class="box">
  <div class="left"></div>
  <div class="right"></div>
    <div class="heading"><h1>รับเงินมัดจำ</h1>
    <div class="buttons"><a onclick="DepositSubmit();" class="button"><span>รับเงินมัดจำ</span></a><a onclick="Javascript:window.location='deposit.php';" class="button"><span>ยกเลิก</span></a></div>
</div>
  <div class="content">
<fieldset class="ui-corner">
<legend>ข้อมูลห้องพัก</legend>
<?php
$rQuery = mysql_query("SELECT reservation_checkin FROM reservation WHERE reservation_detail_id='$id' GROUP BY reservation_checkin ");
$a=0;
while($rRow = mysql_fetch_array($rQuery)){
	$a++;
	$sQuery = mysql_query("SELECT room.room_name as room_name,room.room_pax as room_pax FROM reservation,room WHERE room.room_id = reservation.room_id AND reservation.reservation_checkin = '".$rRow['reservation_checkin']."' AND reservation.reservation_detail_id='$id'");
	
	echo "<div style=\"padding-bottom:5px;\"><b>วันที่ </b>".thai_date(strtotime($rRow['reservation_checkin']))."<b> &nbsp;&nbsp;ห้อง &nbsp;&nbsp;&nbsp;</b>";
	while($sRow = mysql_fetch_array($sQuery)){
		$room_name .= ", <b>".$sRow['room_name']."</b> (พัก ".$sRow['room_pax']." ท่าน)";
		$Room_Pax = $Room_Pax + $sRow['room_pax'];
	}
	echo substr($room_name, 2);
	echo "</div>";
	$room_name = "";

}

?>
</fieldset>

<?php 
//แสดงข้อมูลผู้จอง
$nQuery = mysql_query("SELECT * FROM reservation_detail WHERE reservation_detail_id='$id'");
$nRow = mysql_fetch_array($nQuery);
?>
<fieldset class="ui-corner">
<legend>ข้อมูลผู้จอง</legend>
    <table class="form">
       <tr>
        <td>ชื่อ : </td>
        <td><?php echo $nRow['reservation_detail_fname'];?></td>
      </tr>
       <tr>
        <td>นามสกุล : </td>
        <td><?php echo $nRow['reservation_detail_lname'];?></td>
      </tr>      
       <tr>
        <td>ชื่อบริษัท : </td>
        <td><?php echo $nRow['reservation_detail_name'];?></td>
      </tr>   
       <tr>
        <td>เบอร์โทรศัพท์ : </td>
        <td><?php echo $nRow['reservation_detail_phone'];?></td>
      </tr>   
       <tr>
        <td>เบอร์แฟ็กซ์ : </td>
        <td><?php echo $nRow['reservation_detail_fax'];?></td>
      </tr>   
       <tr>
        <td>อีเมล์ : </td>
        <td><?php echo $nRow['reservation_detail_email'];?></td>
      </tr>                                
    </table>
</fieldset>

<fieldset class="ui-corner">
<legend>ข้อมูลการชำระเงิน</legend>
<div style="width:680px;">
<?php
//กรณีเลือกบริษัททัวร์
if($nRow['reservation_detail_payment_information']=='special'){
	$gValue = $nRow['group_detail_id'];
	$rQuery = mysql_query("SELECT roomtype.roomtype_id as roomtype,roomtype.roomtype_name as roomtype_name,count(roomtype.roomtype_id) as roomtype_id,group_detail_room.group_detail_room_price as group_detail_room_price FROM reservation,roomtype,room,group_detail,group_detail_room WHERE group_detail_room.group_detail_id = group_detail.group_detail_id AND group_detail_room.roomtype_id = roomtype.roomtype_id AND room.roomtype_id=group_detail_room.roomtype_id AND room.room_id=reservation.room_id AND group_detail.group_detail_id = '".$gValue."' AND reservation.reservation_detail_id = '$id' GROUP BY roomtype.roomtype_id ORDER BY roomtype.roomtype_name");

	$sQuery = mysql_query("SELECT group_detail_name FROM group_detail WHERE group_detail_id = '".$gValue."'");
	$sRow = mysql_fetch_array($sQuery);
?>
<h4>บริษัท <?php echo $sRow['group_detail_name'];?></h4>
<table class="list">
<thead>
  <tr>
    <td class="center">ลำดับ</td>
    <td class="center">รายการ</td>
    <td class="center">จำนวน</td>
    <td class="center">ราคา/หน่วย</td>
    <td class="center">รวม</td>
  </tr>
</thead>
<?php 
$num=0;
while($rRow = mysql_fetch_array($rQuery)){
	$num++;
?>
  <tr>
    <td class="center"><?php echo $num;?></td>
    <td class="pLeft">
    <?php echo $rRow['roomtype_name']." ";
    	$RmQuery = mysql_query("SELECT room.room_name as room_name FROM room,reservation,roomtype WHERE reservation.reservation_detail_id = '$id' AND room.roomtype_id=roomtype.roomtype_id AND room.room_id = reservation.room_id AND roomtype.roomtype_id = '".$rRow['roomtype']."' GROUP BY room.room_id");
    	while($RmRow = mysql_fetch_array($RmQuery)){
    		$room_name .= ", ".$RmRow['room_name'];
    	}
    		echo "(".substr($room_name, 2).")";
		$room_name = "";
    ?></td>
    <td class="pRight"><?php echo $rRow['roomtype_id'];?></td>
    <td class="pRight"><?php echo bath_format($rRow['group_detail_room_price']);?></td>
    <td class="pRight"><?php echo bath_format($rRow['roomtype_id']*$rRow['group_detail_room_price']);?></td>
  </tr>
<?php 
	$strtal = $strtal+($rRow['roomtype_id']*$rRow['group_detail_room_price']);
}
}

//กรณีเลือก W/N
if($nRow['reservation_detail_payment_information']=='walkin'){
	$rQuery = mysql_query("SELECT roomtype.roomtype_id as roomtype,roomtype_name,count(roomtype.roomtype_id) as roomtype_id,roomtype.roomtype_price as roomtype_price FROM reservation,roomtype,room WHERE reservation.reservation_detail_id = '$id' AND room.roomtype_id=roomtype.roomtype_id AND room.room_id=reservation.room_id GROUP BY roomtype.roomtype_id ORDER BY roomtype.roomtype_name");
	$discount = $_POST['discount'];
	$discount2 = $_POST['discount2'];

?>
<!-- แสดงรายการ Walk-in -->
<h3>W/N</h3>
<table class="list">
<thead>
  <tr>
    <td class="center">ลำดับ</td>
    <td class="center">รายการ</td>
    <td class="center">จำนวน</td>
    <td class="center">ราคา/หน่วย</td>
    <td class="center">รวม</td>
  </tr>
</thead>
<?php 
$num=0;
while($rRow = mysql_fetch_array($rQuery)){
	$num++;
?>
  <tr>
    <td class="center"><?php echo $num;?></td>
    <td class="pLeft">
    <?php echo $rRow['roomtype_name']." ";
    	$RmQuery = mysql_query("SELECT room.room_name as room_name FROM room,reservation,roomtype WHERE reservation.reservation_detail_id = '$id' AND room.roomtype_id=roomtype.roomtype_id AND room.room_id = reservation.room_id AND roomtype.roomtype_id = '".$rRow['roomtype']."' GROUP BY room.room_id");
    	while($RmRow = mysql_fetch_array($RmQuery)){
    		$room_name .= ", ".$RmRow['room_name'];
    	}
    		echo "(".substr($room_name, 2).")";
		$room_name = "";
    ?></td>
    <td class="pRight"><?php echo $rRow['roomtype_id'];?></td>
    <td class="pRight"><?php echo bath_format($rRow['roomtype_price']);?></td>
    <td class="pRight"><?php echo bath_format($rRow['roomtype_id']*$rRow['roomtype_price']);?></td>
  </tr>
<?php 
	$strtal = $strtal+($rRow['roomtype_id']*$rRow['roomtype_price']);
}
}
?>
<?php 
//กรณีเลือกกรุ๊ป
if($nRow['reservation_detail_payment_information']=='group'){

	$gQuery = mysql_query("SELECT * FROM reservation_group WHERE reservation_detail_id = '$id'");
?>
<h3>กรุ๊ป</h3>
<table class="list">
<thead>
  <tr>
    <td class="center" width="1">ลำดับ</td>
    <td class="center">รายการ</td>
    <td class="center" width="13%">จำนวน</td>
    <td class="center" width="13%">ราคา/หน่วย</td>
    <td class="center" width="18%">รวม</td>
  </tr>
</thead>
<?php 
	$cCount = 0;
	while($gRow = mysql_fetch_array($gQuery)){
		$cCount++;
?>
  <tr>
    <td class="center"><?php echo $cCount;?></td>
    <td class="pLeft"><?php echo $gRow['reservation_group_list'];?></td>
    <td class="pRight"><?php echo $gRow['reservation_group_amount'];?></td>
    <td class="pRight"><?php echo bath_format($gRow['reservation_group_price']);?></td>
    <td class="pRight"><?php echo bath_format($gRow['reservation_group_amount']*$gRow['reservation_group_price']);?></td>
  </tr>
<?php 
	$strtal = $strtal+($gRow['reservation_group_amount']*$gRow['reservation_group_price']);
	}
?>
  <tr>
	<td colspan="4" class="center"><b>รวมเงิน</b></td>
	<td class="pRight"><b><?php echo bath_format($strtal);?></b></td>
  </tr>
</table>
<?php
}
?>


<?php 
//กรณีเลือก Special กับ Walkin
$swQuery = mysql_query("SELECT reservation_detail_payment_information FROM reservation_detail WHERE reservation_detail_id = '$id'");
$swRow = mysql_fetch_array($swQuery);
if($swRow['reservation_detail_payment_information']=='special' || $swRow['reservation_detail_payment_information']=='walkin'){
?>
<?php
/*
1 = รวมอาหารเช้า
2 = Extra Bed + ABF
3 = Extra Bed
4 = ABF (ผู้ใหญ่)
5 = ABF (เด็ก)
6 = พักเพิ่ม (ผู้ใหญ่)
7 = พักเพิ่ม (เด็ก)
*/
//เช็คข้อมูลจากตาราง reservation_information ว่าเลือก more_information_id อะไรเพื่อนำข้อมูลมาแสดง
$StAbfQuery = mysql_query("SELECT more_information_value,more_information_price FROM reservation_information WHERE reservation_detail_id = '$id' AND more_information_id = '1'");
$StAbfRow = mysql_fetch_array($StAbfQuery);
if($StAbfRow){
	$NumtABF = 1;
?>
  <tr>
    <td class="center"><?php echo $num+$NumtABF;?></td>
    <td class="pLeft"><?php echo "รวมอาหารเช้า";?></td>
    <td class="pRight"><?php echo $StAbfRow['more_information_value'];?></td>
    <td class="pRight"><?php echo bath_format($StAbfRow['more_information_price']);?></td>
    <td class="pRight"><?php $tABFTotal = $StAbfRow['more_information_value']*$StAbfRow['more_information_price']; echo bath_format($tABFTotal);?></td>
  </tr>
<?php } ?>
<?php 
//กรณีหากมีข้อมูล Extra Bed + ABF
$SExtraAbfQuery = mysql_query("SELECT more_information_value,more_information_price FROM reservation_information WHERE reservation_detail_id = '$id' AND more_information_id = '2'");
$SExtraAbfRow = mysql_fetch_array($SExtraAbfQuery);
if($SExtraAbfRow){
	$NumExtraAbf = 1;
?>
  <tr>
    <td class="center"><?php echo $num+$NumExtraAbf+$NumtABF;?></td>
    <td class="pLeft"><?php echo "Extra Bed + ABF";?></td>
    <td class="pRight"><?php echo $SExtraAbfRow['more_information_value'];?></td>
    <td class="pRight"><?php echo bath_format($SExtraAbfRow['more_information_price']);?></td>
    <td class="pRight"><?php $ExtraAbfTotal = $SExtraAbfRow['more_information_value']*$SExtraAbfRow['more_information_price']; echo bath_format($ExtraAbfTotal);?></td>
  </tr>
<?php } ?>
<?php 
//กรณีหากมีข้อมูล Extra Bed
$SExtraQuery = mysql_query("SELECT more_information_value,more_information_price FROM reservation_information WHERE reservation_detail_id = '$id' AND more_information_id = '3'");
$SExtraRow = mysql_fetch_array($SExtraQuery);
if($SExtraRow){
	$NumExtra = 1;
?>
  <tr>
    <td class="center"><?php echo $num+$NumExtraAbf+$NumtABF+$NumExtra;?></td>
    <td class="pLeft"><?php echo "Extra Bed";?></td>
    <td class="pRight"><?php echo $SExtraRow['more_information_value'];?></td>
    <td class="pRight"><?php echo bath_format($SExtraRow['more_information_price']);?></td>
    <td class="pRight"><?php $ExtraTotal = $SExtraRow['more_information_value']*$SExtraRow['more_information_price']; echo bath_format($ExtraTotal);?></td>
  </tr>
<?php } ?>
<?php 
//กรณีหากมีข้อมูล ABF (ผู้ใหญ่)
$AbfAQuery = mysql_query("SELECT more_information_value,more_information_price FROM reservation_information WHERE reservation_detail_id = '$id' AND more_information_id = '4'");
$AbfARow = mysql_fetch_array($AbfAQuery);
if($AbfARow){
	$NumAbfA = 1;
?>
  <tr>
    <td class="center"><?php echo $num+$NumExtraAbf+$NumtABF+$NumExtra+$NumAbfA;?></td>
    <td class="pLeft"><?php echo "ABF (ผู้ใหญ่)";?></td>
    <td class="pRight"><?php echo $AbfARow['more_information_value'];?></td>
    <td class="pRight"><?php echo bath_format($AbfARow['more_information_price']);?></td>
    <td class="pRight"><?php $AbfATotal = $AbfARow['more_information_value']*$AbfARow['more_information_price']; echo bath_format($AbfATotal);?></td>
  </tr>
<?php } ?>
<?php 
//กรณีหากมีข้อมูล ABF (เด็ก)
$AbfCQuery = mysql_query("SELECT more_information_value,more_information_price FROM reservation_information WHERE reservation_detail_id = '$id' AND more_information_id = '5'");
$AbfCRow = mysql_fetch_array($AbfCQuery);
if($AbfCRow){
	$NumAbfC = 1;
?>
  <tr>
    <td class="center"><?php echo $num+$NumExtraAbf+$NumtABF+$NumExtra+$NumAbfA+$NumAbfC;?></td>
    <td class="pLeft"><?php echo "ABF (เด็ก)";?></td>
    <td class="pRight"><?php $AbfC = $AbfCRow['more_information_value']; echo $AbfC;?></td>
    <td class="pRight"><?php echo bath_format($AbfCRow['more_information_price']);?></td>
    <td class="pRight"><?php $AbfCTotal = $AbfC*$AbfCRow['more_information_price']; echo bath_format($AbfCTotal);?></td>
  </tr>
<?php } ?>
<?php 
//กรณีหากมีข้อมูล พักเพิ่ม (ผู้ใหญ่)
$AddAQuery = mysql_query("SELECT more_information_value,more_information_price FROM reservation_information WHERE reservation_detail_id = '$id' AND more_information_id = '6'");
$AddARow = mysql_fetch_array($AddAQuery);
if($AddARow){
	$NumAddA = 1;
?>
  <tr>
    <td class="center"><?php echo $num+$NumExtraAbf+$NumtABF+$NumExtra+$NumAbfA+$NumAbfC+$NumAddA;?></td>
    <td class="pLeft"><?php echo "พักเพิ่ม (ผู้ใหญ่)";?></td>
    <td class="pRight"><?php $AddA = $AddARow['more_information_value']; echo $AddA;?></td>
    <td class="pRight"><?php echo bath_format($AddARow['more_information_price']);?></td>
    <td class="pRight"><?php $AddATotal = $AddA*$AddARow['more_information_price']; echo bath_format($AddATotal);?></td>
  </tr>
<?php } ?>
<?php 
//กรณีหากมีข้อมูล พักเพิ่ม (เด็ก)
$AddCQuery = mysql_query("SELECT more_information_value,more_information_price FROM reservation_information WHERE reservation_detail_id = '$id' AND more_information_id = '7'");
$AddCRow = mysql_fetch_array($AddCQuery);
if($AddCRow){
	$NumAddC = 1;
?>
  <tr>
    <td class="center"><?php echo $num+$NumExtraAbf+$NumtABF+$NumExtra+$NumAbfA+$NumAbfC+$NumAddC+$NumAddA;?></td>
    <td class="pLeft"><?php echo "พักเพิ่ม (เด็ก)";?></td>
    <td class="pRight"><?php $AddC = $AddCRow['more_information_value']; echo $AddC;?></td>
    <td class="pRight"><?php echo bath_format($AddCRow['more_information_price']);?></td>
    <td class="pRight"><?php $AddCTotal = $AddC*$AddCRow['more_information_price']; echo bath_format($AddCTotal);?></td>
  </tr>
<?php } ?>
  <tr>
	<td colspan="4" class="center"><b>รวมเงิน</b></td>
	<td class="pRight"><b><?php $strtalAll = $strtal+$tABFTotal+$ExtraAbfTotal+$ExtraTotal+$AbfATotal+$AbfCTotal+$AddATotal+$AddCTotal; echo bath_format($strtalAll);?></b></td>
  </tr>
</table>
<?php } ?>
<?php 
//แสดงเงินรวมหลังลดแล้วกรณี W/N
if($swRow['reservation_detail_payment_information']=='walkin'){
	$DisQuery = mysql_query("SELECT discount,discount2 FROM reservation_detail WHERE reservation_detail_id = '$id'");
	$DisRow = mysql_fetch_array($DisQuery);
	$mTotal = $strtalAll - $DisRow['discount2'];
?>
<div align="right">ส่วนลด % : <?php echo $DisRow['discount'];?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ส่วนลดเป็นเงิน <?php echo bath_format($DisRow['discount2']);?></div>
<div align="right" style="padding-top: 15px; font-weight: bold;">รวมเป็นเงิน <?php echo bath_format($mTotal);?> บาท</div>
<?php } ?>
<!--เก็บยอดรวมไว้สำหรับคิดค่ามัดจำ--> 
<?php
if($swRow['reservation_detail_payment_information']=='walkin'){
?>
<input type="hidden" id="total" name="total" value="<?php echo $mTotal; ?>" />
<?php
}
if($swRow['reservation_detail_payment_information']=='group'){
?>
<input type="hidden" id="total" name="total" value="<?php echo $strtal; ?>" />
<?php
}
if($swRow['reservation_detail_payment_information']=='special'){
?>
<input type="hidden" id="total" name="total" value="<?php echo $strtalAll; ?>" />
<?php
}
?>
<!-- จบ การเก็บยอดรวมไว้สำหรับคิดค่ามัดจำ -->
</div>
</fieldset>

<fieldset class="ui-corner">
<legend>ข้อมูลรายละเอียดเพิ่มเติม</legend>
<?php echo $nRow['reservation_detail_detail'];?>
</fieldset>

<fieldset class="ui-corner">
<legend>ข้อมูลผู้รับจอง</legend>
   <table class="form">
       <tr>
        <td>ชื่อ-นามสกุล : </td>
        <td><?php echo $nRow['reservation_detail_sale_name'];?></td>
      </tr>
       <tr>
        <td>เบอร์โทรศัพท์ : </td>
        <td><?php echo $nRow['reservation_detail_sale_phone'];?></td>
      </tr>                              
    </table>
</fieldset>

<fieldset class="ui-corner addprint" >
<legend>รับเงินมัดจำ</legend>
<input type="hidden" id="reservation_id" name="reservation_id" value="<?php echo $id; ?>" />
   <table class="form" id="deposit_Form">
       <tr>
        <td><input type="radio" id="rRdo_1" name="receive_rdo" value="cash" /> <label for="rRdo_1">เงินสด</label></td>
        <td>เป็น <input type="text" id="cash_percent" name="cash_percent" size="5" maxlength="2" value="0" style="text-align: right;" onfocus="receive_select('rRdo_1');clickclear1(this, this.value);" onkeyup="sTotal1();IsNumeric1001(this.value,this);" onblur="clickrecall1(this);sTotal1();"  /> % &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            รวมเป็นเงิน <input type="text" id="cash_total" name="cash_total" value="0" size="5" style="text-align: right;" onfocus="receive_select('rRdo_1');clickclear1(this, this.value);" onblur="clickrecall1(this);" onkeyup="ClearDis1();" /> บาท
            <input type="hidden" name="Sdiscount" id="Sdiscount" value="" />
            <input type="hidden" name="Sdiscount2" id="Sdiscount2" value="" />
        </td>
      </tr>
       <tr>
        <td><input type="radio" id="rRdo_2" name="receive_rdo" value="transfer" /> <label for="rRdo_2">เงินโอน</label></td>
        <td><select id="bank_transfer" name="bank_transfer" onchange="receive_select('rRdo_2');transfer_focus();">
                <option value="">กรุณาเลือกธนาคาร</option>
<?php 
                $bQuery = mysql_query("SELECT * FROM bank");
                while($bRow = mysql_fetch_array($bQuery)){
?>
                 <option value="<?php echo $bRow['bank_id'].'#'.$bRow['bank_name']; ?>"><?php echo $bRow['bank_name']; ?></option>
<?php
                }
?>
            </select> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; เป็นเงิน <input type="text" id="transfer_total" name="transfer_total" onfocus="receive_select('rRdo_2');" size="5"  style="text-align: right;" value=""  /> บาท</td>
      </tr>                              
      <tr>
          <td><input type="radio" id="rRdo_3" name="receive_rdo" value="check" /> <label for="rRdo_3">เช็ค</label></td>
          <td>เลขที่ <input type="text" id="check_number" name="check_number" size="12" value="" onfocus="receive_select('rRdo_3');"/> &nbsp;&nbsp;&nbsp; ธนาคาร <input type="text" id="check_bank" name="check_bank" size="10" value="" onfocus="receive_select('rRdo_3');" /> &nbsp;&nbsp;&nbsp;&nbsp; เป็นเงิน <input type="text" id="check_total" name="check_total" size="5" value="" style="text-align: right;"  onclick="receive_select('rRdo_3');" /> บาท</td>
      </tr>
    </table>
</fieldset>
      
<fieldset class="ui-corner addprint">
<legend>ชื่อผู้รับเงินมัดจำ</legend>
   <table class="form">
       <tr>
        <td>ชื่อ-นามสกุล : </td>
        <td><input type="text" id="name_receive" name="name_receive" value="" /></td>
      </tr>
       <tr>
        <td>เบอร์โทรศัพท์ : </td>
        <td><input type="text" id="phone_receive" name="phone_receive" value="" /></td>
      </tr>                              
    </table>
</fieldset>
  </div>
</div>
</form>
</body>
<?php include('footer.php');?>
